import React, { Suspense } from 'react';
import './index.less';
import { HashRouter, Route, Switch } from 'react-router-dom';
import routes from '../config/routeConfig';

function Router(props: any) {
  console.log('router props', props);
  return (
    <Suspense fallback={<span className='page-loading'>加载中...</span>}>
      <HashRouter>
        <Switch>
          {routes.map((item, index) => {
            return <Route key={index} exact path={item.path} component={item.component} />;
          })}
        </Switch>
      </HashRouter>
    </Suspense>
  );
}
export default Router;
/**
 *  routes 路由配置文件
 *   参考文件:https://segmentfault.com/a/1190000010401312
 *           https://segmentfault.com/a/1190000039190541
 *
 */
